<template>
  <!--  新建订单-->
  <div class="createOrder-index module-index">
    <breadcrumb-title :title="title"/>
    <div class="createOrder-body module-body">

      <upload-image/>


      <!--    创建订单-->
      <div class="createOrder-title">
        <div class="body-item-title">
          <span>创建订单</span>
        </div>
        <div class="body-item-body">
        <span>
          &nbsp;&nbsp;
          <span style="color: red">*</span>
          订单号：系统自动生成
        </span>
        </div>
      </div>

      <!--    运输地址-->
      <transport-address ref="transport-address"/>
      <!--      委托人-->
      <Trustee ref="trustee"/>
      <!--      收货人-->
      <consignee ref="consignee"/>


      <!--    计划时间-->
      <planed-time ref="planed-time"/>
      <!--    获取信息-->
      <load-information ref="load-information" :if-show="ifShow"/>
      <!--      备注-->
      <remarks ref="remarks"/>

      <div class="submit">
        <el-button @click="submit">提交</el-button>
        <el-button @click="$router.push({name: 'quotationManage'})">取消</el-button>
      </div>


    </div>

  </div>
</template>

<script>
import TransportAddress from "@/components/order/component/TransportAddress";
import BreadcrumbTitle from "@/components/title/BreadcrumbTitle";
import PlanedTime from "@/components/order/component/PlanedTime";
import LoadInformation from "@/components/order/component/LoadInformation";
import Remarks from "@/components/order/component/Remarks";
import Consignee from "@/components/order/component/Consignee";
import Trustee from "@/components/order/component/Trustee";
import UploadImage from "@/components/order/component/UploadImage";
import {ifNullToObject} from "@/utils/constant/listElementCompute";

export default {
  name: "QuotationIndex",
  props: {},
  components: {
    BreadcrumbTitle,
    TransportAddress,
    PlanedTime,
    LoadInformation,
    Remarks,
    Consignee,
    Trustee,
    UploadImage,

  },
  data() {
    return {
      ifShow: true,
      ifAdd: true,
      title: '',
      data: {
        address: {}, // 运输地址
        planTime: {}, // 计划时间
        trusteeInfo: {},   // 委托人
        consigneeInfo: {}, // 收货人
        loadInfo: {
          loadInformation: [],  // 货物信息
          total: {},  // 获取信息总数
        },
        remarks: '',
      }
    }
  },
  created() {

    this.init()
  },
  methods: {
    async init() {
      this.title = this.$route.meta.title

    },

    // 提交
    submit() {
      // 获取组件中的属性
      this.data.address = this.$refs['transport-address'].data
      this.data.planTime = this.$refs['planed-time'].data
      this.data.loadInfo = this.$refs['load-information'].data
      this.data.remarks = this.$refs['remarks'].data
      this.data.trusteeInfo = this.$refs['trustee'].data
      this.data.consigneeInfo = this.$refs['consignee'].data
      // 必要信息填写
      console.log(ifNullToObject(this.data))
      if (!ifNullToObject(this.data)) {
        this.$message.error("请将必要信息填写完整")
      } else {


      }
    },


  }
}
</script>

<style scoped lang="scss">

.createOrder-index {

  .createOrder-body {

    .createOrder-title {
      width: 100%;
      height: 100px;
      border-bottom: 1px black solid;

      .body-item-body {
        width: 100%;
        height: 60px;
        line-height: 60px;
        font-size: 18px;
      }

      .body-item-title {
        padding-left: 4px;
        width: 100%;
        height: 40px;
        line-height: 40px;
        font-size: 18px;
        background-color: #B3C0D1;
      }
    }

    .submit {
      margin: 20px 0;
    }
  }

}


</style>